<%@ page language="java" contentType="text/html;charset=UTF-8"%>
<%@ include file="/commons/taglibs.jsp"%>
<%@ include file="/commons/tree.jsp"%>
<%@ include file="/commons/commonEdit.jsp"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
<script type="text/javascript" src="${ctx}/scripts/common.js"></script>
<script type="text/javascript">

var currentCount=0;

    function selectItem(itemId){

       if(tree.getUserData(itemId,"dept")=='dept')return ;

       var personId=itemId
       var personName=tree.getItemText(itemId);
       var deptId=tree.getParentId(itemId);
        var deptName =tree.getItemText(deptId);


        document.getElementById("dept").value=deptName;
        document.getElementById("deptId").value=deptId;
        document.getElementById("userCode").value=personId;
        document.getElementById("employeeName").value=personName;
           document.addForm.submit();

    }

    function callbackTree(){
    }

    function submitForm(){
    if(currentCount == 0 && '${allowNull}'=='false')
	  {
	   Alert('请选择一条记录!');
	   return false;
	  }
    window.location.href="${ctx}/common_employeeQuery.do?method=saveSelectPerson&frameName=${frameName}&callBack=${callBack}";
     }

     function setCurrentCount(id){
     currentCount=id;
     }

</script>
</head>

<body>

<div style="height:450px;">


<form  name="addForm" id="addForm" action="${ctx}/common_employeeQuery.do?method=addPerson&multiple=${multiple}" method="post" target="personMainFrame">
<input type="hidden" name="dept" value="">
<input type="hidden" name="deptId" value="">
<input type="hidden" name="userCode" value="">
<input type="hidden" name="employeeName" value="">
</form>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td class="window_head_outBg"><table border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td><img src="${ctx}/images/ico_Advance.gif" width="16" height="16" align="absmiddle"> <span class="window_head_intext">选择人</span></td>
        </tr>
    </table></td>
  </tr>
  <tr>
    <td class="aux_header_line_1"></td>
  </tr>
  <tr>
    <td class="aux_header_line_2"></td>
  </tr>
  </table>

<div style="overflow:auto; height:410px;">
<table width="100%" border="0" cellspacing="0" cellpadding="0">

  <tr>
    <td width="25%" valign="top">

<table width="100%" valign="right" border="0" align="right" cellpadding="0" cellspacing="0"  >
  <tr>
    <td  valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="outside_border" >
	 <tr>
        <td valign="top" ><table width="100%" height="496" border="0" cellpadding="0" cellspacing="0" id=topadcontent_10>


          <tr>
            <td valign="top">

			<div id="house_tree" style="overflow:auto;width:100%;height:500px;"></div>
<script type="text/javascript">

        try {
        var tree=new dhtmlXTreeObject("house_tree","100%","100%",0);
		tree.setImagePath("${ctx}/images/tree/");
		tree.setOnClickHandler(selectItem);

		tree.loadXML("${ctx}/common_employeeQuery.do?method=getAllPersonTree");
		 tree.setXMLAutoLoading("${ctx}/common_employeeQuery.do?method=openRequestNodes");
		} catch(e) {

		}

</script>

			</td>
          </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table></td>
<td  width="81%" align="center" valign="top"><iframe src="${ctx}/common_employeeQuery.do?method=hadSelectPersonList" name="personMainFrame" id="personMainFrame" width="100%"  height="400px"  frameborder="0" border="0"  scroll="no" ></iframe></td>
  </tr>
</table>
</div>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
    <td class="window_footer"><table border="0" align="right" cellpadding="0" cellspacing="0">
        <tr>
          <td><table border="0" cellpadding="0" cellspacing="0">

          </table></td>
		  <td class="btn_between_space"></td>
          <td><table border="0" cellpadding="0" cellspacing="0" >
            <tr>
              <td class="buttonOffLeft" id="btn1_51"></td>
              <td class="buttonOffMiddle" id="btn1_52" onblur="btn_change(5)" onMouseOver="btn_change_over(5)" onMouseOut="btn_change_out(5)" onClick="submitForm();"><img src="${ctx}/images/ico_ok.gif" border="0" align="absmiddle" />${key.save}</td>
              <td class="buttonOffRight" id="btn1_53"></td>
            </tr>
        </table></td>
        <td class="btn_between_space"></td>
        <td><table border="0" cellpadding="0" cellspacing="0">
            <tr>
              <td class="buttonOffLeft" id="btn1_31"></td>
              <td class="buttonOffMiddle" id="btn1_32" onblur="btn_change(3)"  onClick="windowClose();" onMouseOver="btn_change_over(3)" onMouseOut="btn_change_out(3)"><img src="${ctx}/images/ico_cancel.gif" border="0" align="absmiddle" />${key.close}</td>
              <td class="buttonOffRight" id="btn1_33"></td>
            </tr>
        </table></td>
      </tr>
    </table></td>
  </tr>
</table>
</div>




</body>
</html>
